/*
  Copyright 2013 the JSDoc Authors.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      https://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/
describe('@member tag', () => {
  const docSet = jsdoc.getDocSetFromFile('test/fixtures/membertag.js');
  const doc = docSet.getByLongname('x')[0];
  const doc2 = docSet.getByLongname('foobar')[0];
  const doc3 = docSet.getByLongname('baz')[0];
  const doc4 = docSet.getByLongname('y')[0];

  it("sets the doclet's 'kind' property to 'member'", () => {
    expect(doc.kind).toBe('member');
    expect(doc2.kind).toBe('member');
    expect(doc3.kind).toBe('member');
    expect(doc4.kind).toBe('member');
  });

  it("If specified with a name, sets the doclet's name property", () => {
    expect(doc.name).toBe('x');
    expect(doc2.name).toBe('foobar');
    expect(doc3.name).toBe('baz');
  });

  it("If specified with a type and name, sets the doclet's type appropriately", () => {
    expect(doc3.type.names).toBeArrayOfSize(1);
    expect(doc3.type.names[0]).toBe('string');
  });

  it("If specified with a type but no name, sets the doclet's name from the following JavaScript syntax", () => {
    expect(doc4.name).toBe('y');
  });

  it("If specified with a type but no name, sets the doclet's type appropriately", () => {
    expect(doc4.type.names).toBeArrayOfSize(1);
    expect(doc4.type.names[0]).toBe('Object');
  });
});
